{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 2  9  7  6  5]\n",
      " [13  9 18 10 14]\n",
      " [ 2  0 18 12  6]] \n",
      "\n",
      "[[ 5 19  4]\n",
      " [ 4  5  0]\n",
      " [ 4 14 12]\n",
      " [ 0  4  6]\n",
      " [ 7  6 17]]\n"
     ]
    }
   ],
   "source": [
    "a=np.random.randint(0,20,size=(3,5))\n",
    "b=np.random.randint(0,20,size=(5,3))\n",
    "print(a,'\\n')\n",
    "print(b)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 矩阵内积"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[109, 235, 213],\n",
       "       [271, 668, 566],\n",
       "       [124, 374, 398]])"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c=np.dot(a,b)\n",
    "c"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 对应元素相乘"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 3  1 18 15  3]\n",
      " [10  6 12 13 16]\n",
      " [19  3  7  7 13]] \n",
      "\n",
      "[[ 2  9  7  6  5]\n",
      " [13  9 18 10 14]\n",
      " [ 2  0 18 12  6]]\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "array([[  6,   9, 126,  90,  15],\n",
       "       [130,  54, 216, 130, 224],\n",
       "       [ 38,   0, 126,  84,  78]])"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d=np.random.randint(0,20,size=(3,5))\n",
    "print(d,'\\n')\n",
    "print(a)\n",
    "e=np.multiply(a,d)\n",
    "e"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
